<template>
  <div>
    <a-input v-if="isEdit" :default-value='defaultVal' @change='textChangeHandler'/>
    <span v-else>{{defaultVal}}</span>
  </div>
</template>
<script>
export default {
  props: {
    columnInfo: {
      type: Object,
      default: () => {}
    },
    data: {
      type: Object,
      default: () => {}
    },
    index: {
      default: 0
    },
    updateRows: {
      type: Array,
      default: () => []
    }
  },
  computed: {
    isEdit() {
      return this.updateRows.includes(this.index)
    },
    defaultVal() {
      return this.data[this.columnInfo.dataIndex]
    }
  },
  methods: {
    textChangeHandler(ev) {
      this.$emit('setUpdateData','name',ev.target.value)
    }
  }
}
</script>
<style scoped lang='less'>
</style>